package com.dinzeer.slashblade_project_slr.se;

import com.dinzeer.legendreliclib.lib.util.FastMakeEntityUtil;
import com.dinzeer.legendreliclib.lib.util.slashblade.AbstractSpecialEffect;
import com.dinzeer.legendreliclib.lib.util.slashblade.SlashBladeUtil;
import com.dinzeer.slashblade_project_slr.entity.TheSlashStringEntity;
import com.dinzeer.slashblade_project_slr.regsiter.SLREntityRegsitry;
import mods.flammpfeil.slashblade.event.SlashBladeEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.LivingEntity;
import net.minecraftforge.event.entity.living.LivingHurtEvent;

public class WitherUnEdge extends AbstractSpecialEffect {

    public WitherUnEdge() {
        super(30);
    }

    @Override
    public void handleLivingHurt(LivingHurtEvent event, LivingEntity attacker) {
        FastMakeEntityUtil.FastEffect(attacker, MobEffects.WITHER, 1);
        TheSlashStringEntity entity=new TheSlashStringEntity(SLREntityRegsitry.TheSlashString.get(), attacker.level());
        entity.setPos(event.getEntity().getX(),
                event.getEntity().getY()+1,
                event.getEntity().getZ());
        entity.setColor(SlashBladeUtil.getColorCode(attacker.getMainHandItem()));
        entity.setAllTimeDamage(true);
        event.getEntity().level().addFreshEntity(entity);
    }
}
